<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>（申请岗位）学生申请岗位</title>
    <link rel="stylesheet" href="../../dist/css/layui.css">
</head>
<body>

<table id="demo" lay-filter="test"></table>

<script src="../../dist/jquery-1_8_3.js"></script>
<script src="../../dist/layui.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer
            ,form = layui.form
            ,$ = layui.jquery
    });

    layui.use('table', function(){
        var table = layui.table;

        //表格设置
        table.render({
            elem: '#demo'
            ,height: 'full-20'
            ,url: '/student/selectJob?place=${param.place}' //数据接口
            ,page: {
                limit : 10,
                limits: [5, 10]

            } //开启分页
            ,cols : [[ //表头
                {field: 'dept', title: '部门',align: "center", width:'15%', sort: true}
                ,{field: 'name', title: '岗位名称',align: "center", width:'15%'}
                ,{field: 'leader', title: '负责老师',align: "center", width:'10%'}
                ,{field: 'place', title: '工作地点',align: "center", width:'20%'}
                ,{field: 'salary', title: '工资',align: "center", width: '10%', sort: true}
                ,{field: 'remain', title: '剩余名额',align: "center", width: '10%', sort: true}
                ,{field: 'operation', title: '操作',  width: '20%', align:'center', toolbar: '#barDemo'}
            ]]
        });

        // 操作选项
        table.on('tool(test)', function (obj) {

            // 本行数据
            var data = obj.data;
            switch (obj.event) {
                case "detail" :
                    layer.open({
                        title: '岗位详情',
                        type:0,
                        content:data.detail.toString(),
                        icon: 6
                    });
                    break;
                case "select" :
                    layer.open({
                        type: 2,
                        title:"新增",
                        area: ['600px', '400px'],
                        offset: ['120px', '200px'],
                        btn: '取消',
                        content: '/jsp/student/application_form.jsp?id='+ data.id,
                        yes:function(index,layero){
                            layer.close(index);
                            return false;
                        },
                        //
                        end : function () {
                        }
                    });
                    break;
            }
        });
    });
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="detail">查看详情</a>
    {{#  if(d.choice === 1){ }}
    <a class="layui-btn layui-btn-sm layui-btn-normal" lay-event="select">选择</a>
    {{#  } else { }}
    <a class="layui-btn layui-btn-disabled layui-btn-sm" lay-event="unselect">无法选择</a>
    {{#  } }}
</script>
</body>
</html>
